import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        number: 1
    },
    mutations: {
        setNumber(state, num) {
            console.log(state)
            state.number += num
        }
    },
    actions: {
        syncSetNumber({ state }, num) {
            setTimeout(() => {
                console.log(state)
                setNumber(state, num)
                console.log(state.number)
            }, 1000);
        }
    },
    modules: {}
})